<script>
  let person = {
    name: "John",
    age: 30,
    gender: "male",
  };
  const changeAge = () => {
    person.age++;
    // person = JSON.parse(JSON.stringify(person));
    // console.log(person);
  };
  $: person ? handlePersonChange() : null;
  const handlePersonChange = () => {
    console.log("person changed");
  };
</script>

<main>
  {person.name}
  {person.age}
  {person.gender}
  <button on:click={changeAge}>Change Age</button>
</main>
